package com.bss.dao;

// Generated Nov 1, 2011 10:54:22 PM by Hibernate Tools 3.3.0.GA

import java.util.List;

import org.springframework.stereotype.Repository;

import com.andy.basics.Dao;
import com.bss.model.Admission;
import com.bss.model.Patient;

@Repository
public class PatientDao extends Dao<Patient> {

	public List<Patient> findPatientsNotCheckedInCurrently(String namePattern) {
		List<Patient> list = this.findComplex("Select patient from " + Patient.class.getName() + " as patient "
				+ "where patient.firstName like '" + namePattern + "%' and patient.id not in " + " (Select adm.patient.id from "
				+ Admission.class.getName() + " adm where adm.dateOfExit is null ) order by patient.firstName asc");
		return list;
	}

}
